package cn.pku.ss.sirx.sna.ib;

import cn.pku.ss.sirx.sna.ib.bean.Message;
import cn.pku.ss.sirx.sna.ib.bean.MessageBoard;

/**
 * Builder message boards.
 *
 * @author SirX
 * @version 1.0
 */
public class MessageBoardBuilder implements IBuilder<MessageBoard> {

    @Override
    public void build(MessageBoard messageBoard) {
        ReplyTreeQueue replyTreeQueue = new ReplyTreeQueue(messageBoard);
        replyTreeQueue.addEnqueueListener(new InfluenceCalculator(replyTreeQueue));
        MessageBuilder messageBuilder = new MessageBuilder(replyTreeQueue);
        for (Message message : messageBoard) {
            messageBuilder.build(message);
        }
        replyTreeQueue.endEnqueue();
    }

}
